/**
 * 部门管理模块配置文件
 */
export interface Department {
  id: number
  name: string
  code: string
  parentId: number | null
  status: number
  remark?: string
  createTime?: string
  updateTime?: string
}

export const moduleApi = '/api/department'
export const moduleName = '部门管理'

export const searchParams = () => [
  {
    label: '部门名称',
    prop: 'name',
    type: 'input',
    placeholder: '请输入部门名称',
  },
  {
    label: '部门编码',
    prop: 'code',
    type: 'input',
    placeholder: '请输入部门编码',
  },
  {
    label: '状态',
    prop: 'status',
    type: 'select',
    options: [
      { label: '启用', value: 1 },
      { label: '禁用', value: 0 },
    ],
  },
]

export const addParams = [
  {
    label: '部门名称',
    prop: 'name',
    type: 'input',
    placeholder: '请输入部门名称',
    required: true,
  },
  {
    label: '部门编码',
    prop: 'code',
    type: 'input',
    placeholder: '请输入部门编码',
    required: true,
  },
  {
    label: '上级部门',
    prop: 'parentId',
    type: 'tree-select',
    placeholder: '请选择上级部门',
  },
  {
    label: '状态',
    prop: 'status',
    type: 'switch',
    activeText: '启用',
    inactiveText: '禁用',
    activeValue: 1,
    inactiveValue: 0,
  },
  {
    label: '备注',
    prop: 'remark',
    type: 'textarea',
    placeholder: '请输入备注信息',
  },
]

export const tableColumns = [
  {
    label: '部门名称',
    prop: 'name',
  },
  {
    label: '部门编码',
    prop: 'code',
  },
  {
    label: '上级部门',
    prop: 'parentName',
  },
  {
    label: '状态',
    prop: 'status',
    slot: true,
  },
  {
    label: '创建时间',
    prop: 'createTime',
  },
  {
    label: '备注',
    prop: 'remark',
  },
]
